- name: Create directories
  file:
    state: directory
    path: "/srv/web/{{item}}"
    owner: apache
    group: apache
    mode: 0755
    setype: httpd_sys_content_t
    seuser: system_u
  with_items:
  - kinoite.fedoraproject.org
  tags:
  - kinoite

- name: Copy synckinoite script (stg)
  when: env == "staging"
  copy:
    src: sync{{item}}.stg.sh
    dest: /usr/local/bin/sync{{item}}
    owner: root
    group: root
    mode: 0755
  with_items:
  - kinoite
  tags:
  - kinoite

- name: Copy synckinoite script (prod)
  when: env == "production"
  copy:
    src: "{{item}}.sh"
    dest: "/usr/local/bin/{{item}}"
    owner: root
    group: root
    mode: 0755
  with_items:
  - synckinoite
  tags:
  - kinoite

- name: Install the synckinoite cron job
  copy:
    src: "{{item}}.cron"
    dest: "/etc/cron.d/{{item}}.cron"
    owner: root
    group: root
    mode: 0644
  with_items:
  - synckinoite
  tags:
  - kinoite
  - cron
